Integrand size = 26, antiderivative size = 72 \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {2 a^2 d (d \cot (e+f x))^{-1+n} \operatorname {Hypergeometric2F1}(1,-1+n,n,-i \cot (e+f x))}{f (1-n)} \]
a^2*d*(d*cot(f*x+e))^(-1+n)/f/(1-n)-2*a^2*d*(d*cot(f*x+e))^(-1+n)*hypergeo m([1, -1+n],[n],-I*cot(f*x+e))/f/(1-n)
Time = 1.02 (sec) , antiderivative size = 52, normalized size of antiderivative = 0.72 \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=-\frac {a^2 d (d \cot (e+f x))^{-1+n} (-1+2 \operatorname {Hypergeometric2F1}(1,1-n,2-n,i \tan (e+f x)))}{f (-1+n)} \]
-((a^2*d*(d*Cot[e + f*x])^(-1 + n)*(-1 + 2*Hypergeometric2F1[1, 1 - n, 2 - n, I*Tan[e + f*x]]))/(f*(-1 + n)))
Time = 0.52 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.11, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.346, Rules used = {3042, 4156, 3042, 4026, 3042, 4020, 25, 27, 74}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int (a+i a \tan (e+f x))^2 (d \cot (e+f x))^n \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (e+f x))^2 (d \cot (e+f x))^ndx\) |
\(\Big \downarrow \) 4156 |
\(\displaystyle d^2 \int (d \cot (e+f x))^{n-2} (\cot (e+f x) a+i a)^2dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle d^2 \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (i a-a \tan \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\) |
\(\Big \downarrow \) 4026 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\int (d \cot (e+f x))^{n-2} \left (2 i a^2 \cot (e+f x)-2 a^2\right )dx\right )\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (-2 i \tan \left (e+f x+\frac {\pi }{2}\right ) a^2-2 a^2\right )dx\right )\) |
\(\Big \downarrow \) 4020 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\frac {4 i a^4 \int -\frac {(d \cot (e+f x))^{n-2}}{2 a^2 \left (2 i \cot (e+f x) a^2+2 a^2\right )}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\) |
\(\Big \downarrow \) 25 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {4 i a^4 \int \frac {(d \cot (e+f x))^{n-2}}{2 a^2 \left (2 i \cot (e+f x) a^2+2 a^2\right )}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\) |
\(\Big \downarrow \) 27 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {i a^2 2^{3-n} \int \frac {2^{n-2} (d \cot (e+f x))^{n-2}}{2 i \cot (e+f x) a^2+2 a^2}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\) |
\(\Big \downarrow \) 74 |
\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {2 a^2 (d \cot (e+f x))^{n-1} \operatorname {Hypergeometric2F1}(1,n-1,n,-i \cot (e+f x))}{d f (1-n)}\right )\) |
d^2*((a^2*(d*Cot[e + f*x])^(-1 + n))/(d*f*(1 - n)) - (2*a^2*(d*Cot[e + f*x ])^(-1 + n)*Hypergeometric2F1[1, -1 + n, n, (-I)*Cot[e + f*x]])/(d*f*(1 - n)))
3.8.89.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x )^(m + 1)/(b*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] && !IntegerQ[m] && (IntegerQ[n] || (GtQ[c, 0] && !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[c*(d/f) Subst[Int[(a + (b/d)*x)^m/(d^2 + c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[ b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] && !LeQ [m, -1] && !(EqQ[m, 2] && EqQ[a, 0])
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x _)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p) Int[(d*Cot[e + f*x])^(m - n*p )*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && !IntegerQ[m] && IntegersQ[n, p]
\[\int \left (d \cot \left (f x +e \right )\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{2}d x\]
\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
integral(4*a^2*((I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) - 1)) ^n*e^(4*I*f*x + 4*I*e)/(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1), x)
\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=- a^{2} \left (\int \left (- \left (d \cot {\left (e + f x \right )}\right )^{n}\right )\, dx + \int \left (d \cot {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\, dx + \int \left (- 2 i \left (d \cot {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx\right ) \]
-a**2*(Integral(-(d*cot(e + f*x))**n, x) + Integral((d*cot(e + f*x))**n*ta n(e + f*x)**2, x) + Integral(-2*I*(d*cot(e + f*x))**n*tan(e + f*x), x))
\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]
Timed out. \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int {\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2 \,d x \]